package com.trkj.controller.wdm;

import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.trkj.pojo.BonusPenaltype;
import com.trkj.pojo.CharacteristicItem;
import com.trkj.pojo.ContractCategory;
import com.trkj.pojo.DefinitionDept;
import com.trkj.pojo.Duty;
import com.trkj.pojo.Edubackground;
import com.trkj.pojo.JobStatus;
import com.trkj.pojo.MaritalStatus;
import com.trkj.pojo.MotherTongue;
import com.trkj.pojo.Nationality;
import com.trkj.pojo.Organization;
import com.trkj.pojo.PlaceWork;
import com.trkj.pojo.ProfessionalTitle;
import com.trkj.pojo.ReasonsLeaving;
import com.trkj.pojo.Skill;
import com.trkj.pojo.SocialRelation;
import com.trkj.pojo.StaffInformation;
import com.trkj.pojo.Worksheet;
import com.trkj.service.ServiceException;
import com.trkj.service.mapper.PostitionChangeService;
import com.trkj.service.wdm.BonusAdministrationService;
import com.trkj.service.wdm.BonusPenaltypeService;
import com.trkj.service.wdm.CharacteristicItemService;
import com.trkj.service.wdm.ContractCategoryService;
import com.trkj.service.wdm.DefinitionDepService;
import com.trkj.service.wdm.DutyService;
import com.trkj.service.wdm.EdubackgroundService;
import com.trkj.service.wdm.JoStatusService;
import com.trkj.service.wdm.MaritalStatusService;
import com.trkj.service.wdm.MotherTongueService;
import com.trkj.service.wdm.NationalityService;
import com.trkj.service.wdm.OrganizationService;
import com.trkj.service.wdm.PlaceWorkService;
import com.trkj.service.wdm.ProfessionalTitleService;
import com.trkj.service.wdm.ReasonsLeavingService;
import com.trkj.service.wdm.SkillService;
import com.trkj.service.wdm.SocialRelationsService;
import com.trkj.service.wdm.WorkSheetService;
import com.trkj.service.wdm.YgztTableService;
import com.trkj.vo.BonusAdministrationVO;
import com.trkj.vo.Result2;
import com.trkj.vo.StafffinalVO;
import com.trkj.vo.YgztTableVO;

@Controller

public class StaffPositionController {
	// 离职
	@Autowired
	private ReasonsLeavingService reasonsleaving;
	// 定义组织
	@Autowired
	private OrganizationService organizationservice;
	// 定义职务
	@Autowired
	private DutyService dutyservice;
	// 定义职称
	@Autowired
	private ProfessionalTitleService professionaltitleservice;
	// 合同类别
	@Autowired
	private ContractCategoryService contractcategoryservice;
	// 定义技能
	@Autowired
	private SkillService skillservice;
	// 定义学历
	@Autowired
	private EdubackgroundService edubackgroundservice;
	// 定义用工状态
	@Autowired
	private JoStatusService jostatusservice;
	// 定义社会关系
	@Autowired
	private SocialRelationsService socialrelationsservice;
	// 定义婚姻状况
	@Autowired
	private MaritalStatusService maritalstatusservice;
	// 定义民族
	@Autowired
	private NationalityService nationalityservice;
	// 定义母语
	@Autowired
	private MotherTongueService mothertongueservice;
	// 定义特征项
	@Autowired
	private CharacteristicItemService characteristicitemservice;
	// 奖惩类别
	@Autowired
	private BonusPenaltypeService bonuspenaltypeservice;
	// 奖惩管理
	@Autowired
	private BonusAdministrationService bonusadministrationservice;
	// 用工状态变动
	@Autowired
	private YgztTableService ygzttableservice;
	// 定义部门
	@Autowired
	private DefinitionDepService definitiondepservice;
	// 定义工作
	@Autowired
	private WorkSheetService worksheetservice;
	// 工作地点
	@Autowired
	private PlaceWorkService placeworkservice;
	@Autowired
	private PostitionChangeService postitionchangeservice;

	// 工作地点
	@GetMapping("to_placework")
	public String placework() {
		return "wdm_placework";
	}

	// 工作地点分页查询
	@RequestMapping("queryByto_placework")
	@ResponseBody
	public Map queryByto_placework(int page, int rows) {
		long total = placeworkservice.queryByPageCount();
		List<PlaceWork> list = placeworkservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增工作地点
	@RequestMapping("insert_placework")
	@ResponseBody
	public Result2 insert_placework(String gzddName, String gzddRemark, Integer gzddState, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			placeworkservice.insert(gzddName, saff.getStainName(), gzddRemark, gzddState);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载工作地点
	@RequestMapping("load_placework")
	@ResponseBody
	public PlaceWork find_placework(Long gzddId) {
		return placeworkservice.loadReasonsLeaving(gzddId);
	}

	// 编辑工作地点
	@RequestMapping("update_placework")
	@ResponseBody
	public Result2 update_placework(Long gzddId, String gzddName, String gzddRemark, Integer gzddState,
			HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			placeworkservice.update(gzddId, gzddName, saff.getStainName(), gzddRemark, gzddState);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 编辑工作地点状态
	@RequestMapping("update_placeworkstate")
	@ResponseBody
	public Result2 update_placeworkstate(Long gzddId, Integer gzddState, HttpSession session) {
		try {
			placeworkservice.updatestate(gzddId, gzddState);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 删除工作状态
	@RequestMapping("delete_placework")
	@ResponseBody
	public Result2 delete_placework(Long gzddId) {
		try {
			placeworkservice.delete(gzddId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 模糊查询工作状态
	@RequestMapping("modaddSeslect_placework")
	@ResponseBody
	public Map modaddSeslect_placework(String text, int page, int rows) {
			long total = placeworkservice.count(text);
			List<PlaceWork> list = placeworkservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 定义工作
	@GetMapping("to_worksheet")
	public String worksheet() {
		return "wdm_worksheet";
	}

	// 定义工作分页查询
	@GetMapping("queryByto_worksheet")
	@ResponseBody
	public Map queryByto_worksheet(int page, int rows) {
		long total = worksheetservice.queryByPageCount();
		List<Worksheet> list = worksheetservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增定义工作
	@RequestMapping("insert_worksheet")
	@ResponseBody
	public Result2 insert_worksheet(String workName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			worksheetservice.insert(workName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义工作
	@RequestMapping("delete_worksheet")
	@ResponseBody
	public Result2 delete_worksheet(Long workId) {
		try {
			worksheetservice.delete(workId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义工作
	@RequestMapping("load_worksheet")
	@ResponseBody
	public Worksheet find_worksheet(Long workId) {
		return worksheetservice.loadReasonsLeaving(workId);
	}

	// 编辑定义工作
	@RequestMapping("update_worksheet")
	@ResponseBody
	public Result2 update_worksheet(Long workId, String workName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			worksheetservice.update(workId, workName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义工作
	@RequestMapping("modaddSeslect_worksheet")
	@ResponseBody
	public Map modaddSeslect_worksheet(String text, int page, int rows) {
			long total = worksheetservice.count(text);
			List<Worksheet> list = worksheetservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 奖惩管理
	@RequestMapping("to_bonus_administration")
	public String bonus_administration() {
		return "wdm_bonus_administration";
	}

	// 奖惩管理分页查询
	@RequestMapping("queryByto_bonus_administration")
	@ResponseBody
	public Map queryByto_bonus_administration(int page, int rows) {
		long total = bonusadministrationservice.queryByPageCount();
		List<BonusAdministrationVO> list = bonusadministrationservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增奖惩管理
	@PostMapping("insert_bonus_administration")
	@ResponseBody
	public Result2 insert_bonus_administration(BonusAdministrationVO bonus) {
		try {
			bonusadministrationservice.insert(bonus);
			return Result2.SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 编辑奖惩管理
	@PostMapping("update2_bonus_administration")
	@ResponseBody
	public Result2 update_bonus_administration(BonusAdministrationVO bonus) {
		try {
			bonusadministrationservice.updateAdministration(bonus);
			return Result2.SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除奖惩管理
	@RequestMapping("delete_bonus_administration")
	@ResponseBody
	public Result2 delete_bonus_administration(Long bpadId) {
		try {
			System.out.println(bpadId);
			bonusadministrationservice.delete(bpadId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// id查询编辑奖惩管理
	@RequestMapping("compile_DisciplinaryPunishment")
	public String compile_DisciplinaryPunishment(Long bpadId, Model m) {
		try {
			m.addAttribute("list", bonusadministrationservice.update(bpadId));
			return "compiledisciplinarypunishment_wdm";
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new ServiceException(e);
		}
	}
	//奖励类别
	@GetMapping("to_jiangli")
	public String to_jiangli() {
		return "wdm_jiangli";
	}
	
	
	
	
	
	// 奖惩类别
	@GetMapping("to_bonus_penaltype")
	public String bonus_penaltype() {
		return "wdm_bonus_penaltype";
	}

	// 奖惩类别分页查询
	@GetMapping("queryByto_bonus_penaltype")
	@ResponseBody
	public Map queryByto_bonus_penaltype(int page, int rows) {
		long total = bonuspenaltypeservice.queryByPageCount();
		List<BonusPenaltype> list = bonuspenaltypeservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增奖惩类别
	@RequestMapping("insert_bonus_penaltype")
	@ResponseBody
	public Result2 insert_bonus_penaltype(String bptName, Integer bptType, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			bonuspenaltypeservice.insert(bptName, saff.getStainName(), bptType);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除奖惩类别
	@RequestMapping("delete_bonus_penaltype")
	@ResponseBody
	public Result2 delete_bonus_penaltype(Long bptId) {
		try {
			bonuspenaltypeservice.delete(bptId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载奖惩类别
	@RequestMapping("load_bonus_penaltype")
	@ResponseBody
	public BonusPenaltype find_bonus_penaltype(Long bptId) {
		return bonuspenaltypeservice.loadReasonsLeaving(bptId);
	}

	// 编辑奖惩类别
	@RequestMapping("update_bonus_penaltype")
	@ResponseBody
	public Result2 update_bonus_penaltype(Long bptId, String bptName, Integer bptType, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			bonuspenaltypeservice.update(bptId, bptName, saff.getStainName(), bptType);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询奖惩类别
	@RequestMapping("modaddSeslect_bonus_penaltype")
	@ResponseBody
	public Map modaddSeslect_bonus_penaltype(String text, int page, int rows) {
			long total = bonuspenaltypeservice.count(text);
			List<BonusPenaltype> list = bonuspenaltypeservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 定义特征项
	@GetMapping("to_characteristic")
	public String to_characteristic() {
		return "wdm_characteristic";
	}

	// 定义特征项分页查询
	@GetMapping("queryByto_characteristic")
	@ResponseBody
	public Map queryByto_characteristic(int page, int rows) {
		long total = characteristicitemservice.queryByPageCount();
		List<CharacteristicItem> list = characteristicitemservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增定义特征项
	@RequestMapping("insert_characteristic")
	@ResponseBody
	public Result2 insert_characteristic(String charaName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			characteristicitemservice.insert(charaName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义特征项
	@RequestMapping("delete_characteristic")
	@ResponseBody
	public Result2 delete_characteristic(Long charaId) {
		try {
			characteristicitemservice.delete(charaId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义特征项
	@RequestMapping("load_characteristic")
	@ResponseBody
	public CharacteristicItem find_characteristic(Long charaId) {
		return characteristicitemservice.loadReasonsLeaving(charaId);
	}

	// 编辑定义特征项
	@RequestMapping("update_characteristic")
	@ResponseBody
	public Result2 update_characteristic(Long charaId, String charaName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			characteristicitemservice.update(charaId, charaName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义特征项
	@RequestMapping("modaddSeslect_characteristic")
	@ResponseBody
	public Map modaddSeslect_characteristic(String text, int page, int rows) {
			long total = characteristicitemservice.count(text);
			List<CharacteristicItem> list = characteristicitemservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 定义部门
	@GetMapping("to_definitiondep")
	public String to_definitiondep() {
		return "wdm_definitiondep";
	}

	// 定义部门分页查询
	@GetMapping("queryByto_definitiondep")
	@ResponseBody
	public Map queryByto_definitiondep(int page, int rows) {
		long total = definitiondepservice.queryByPageCount();
		List<DefinitionDept> list = definitiondepservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增定义部门
	@RequestMapping("insert_definitiondep")
	@ResponseBody
	public Result2 insert_definitiondep(String defideName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			definitiondepservice.insert(defideName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义部门
	@RequestMapping("delete_definitiondep")
	@ResponseBody
	public Result2 delete_definitiondep(Long defideId) {
		try {
			definitiondepservice.delete(defideId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义部门
	@RequestMapping("load_definitiondep")
	@ResponseBody
	public DefinitionDept find_definitiondep(Long defideId) {
		return definitiondepservice.loadReasonsLeaving(defideId);
	}

	// 编辑定义部门
	@RequestMapping("update_definitiondep")
	@ResponseBody
	public Result2 update_definitiondep(Long defideId, String defideName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			definitiondepservice.update(defideId, defideName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义部门
	@RequestMapping("modaddSeslect_definitiondep")
	@ResponseBody
	public Map modaddSeslect_definitiondep(String text, int page, int rows) {
		
			long total = definitiondepservice.count(text);
			List<DefinitionDept> list = definitiondepservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 定义母语
	@GetMapping("to_mother_tongue")
	public String to_mother_tongue() {
		return "wdm_mother_tongue";
	}

	// 定义母语分页查询
	@GetMapping("queryByto_mother_tongue")
	@ResponseBody
	public Map queryByto_mother_tongue(int page, int rows) {
		long total = mothertongueservice.queryByPageCount();
		List<MotherTongue> list = mothertongueservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增定义母语
	@RequestMapping("insert_mother_tongue")
	@ResponseBody
	public Result2 insert_mother_tongue(String mothName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			mothertongueservice.insert(mothName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义母语
	@RequestMapping("delete_mother_tongue")
	@ResponseBody
	public Result2 delete_mother_tongue(Long mothId) {
		try {
			mothertongueservice.delete(mothId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义母语
	@RequestMapping("load_mother_tongue")
	@ResponseBody
	public MotherTongue find_mother_tongue(Long mothId) {
		return mothertongueservice.loadReasonsLeaving(mothId);
	}

	// 编辑定义母语
	@RequestMapping("update_mother_tongue")
	@ResponseBody
	public Result2 update_mother_tongue(Long mothId, String mothName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			mothertongueservice.update(mothId, mothName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义母语
	@RequestMapping("modaddSeslect_mother_tongue")
	@ResponseBody
	public Map modaddSeslect_mother_tongue(String text, int page, int rows) {

			long total = mothertongueservice.count(text);
			List<MotherTongue> list = mothertongueservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 定义学历
	@GetMapping("to_Education")
	public String to_Education() {
		return "education";
	}

	// 定义学历分页查询
	@GetMapping("queryByto_Education")
	@ResponseBody
	public Map queryByto_Education(int page, int rows) {
		long total = edubackgroundservice.queryByPageCount();
		List<Edubackground> list = edubackgroundservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增定义学历
	@RequestMapping("insert_Education")
	@ResponseBody
	public Result2 insert_Education(String eduName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			edubackgroundservice.insert(eduName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义学历
	@RequestMapping("delete_Education")
	@ResponseBody
	public Result2 delete_Education(Long eduId) {
		try {
			edubackgroundservice.delete(eduId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义学历
	@RequestMapping("load_Education")
	@ResponseBody
	public Edubackground find_Education(Long eduId) {
		return edubackgroundservice.loadReasonsLeaving(eduId);
	}

	// 编辑定义学历
	@RequestMapping("update_Education")
	@ResponseBody
	public Result2 update_Education(Long eduId, String eduName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			edubackgroundservice.update(eduId, eduName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义学历
	@RequestMapping("modaddSeslect_Education")
	@ResponseBody
	public Map modaddSeslect_Education(String text, int page, int rows) {

			long total = edubackgroundservice.count(text);
			List<Edubackground> list = edubackgroundservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 定义婚姻状况
	@GetMapping("to_marital_status")
	public String to_marital_status() {
		return "wdm_marital_status";
	}

	// 定义婚姻状况分页查询
	@GetMapping("queryByto_marital_status")
	@ResponseBody
	public Map queryByto_marital_status(int page, int rows) {
		long total = maritalstatusservice.queryByPageCount();
		List<MaritalStatus> list = maritalstatusservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增定义婚姻状况
	@RequestMapping("insert_marital_status")
	@ResponseBody
	public Result2 insert_marital_status(String marName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			maritalstatusservice.insert(marName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义婚姻状况
	@RequestMapping("delete_marital_status")
	@ResponseBody
	public Result2 delete_marital_status(Long marId) {
		try {
			maritalstatusservice.delete(marId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义婚姻状况
	@RequestMapping("load_marital_status")
	@ResponseBody
	public MaritalStatus find_marital_status(Long marId) {
		return maritalstatusservice.loadReasonsLeaving(marId);
	}

	// 编辑定义婚姻状况
	@RequestMapping("update_marital_status")
	@ResponseBody
	public Result2 update_marital_status(Long marId, String marName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			maritalstatusservice.update(marId, marName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义婚姻状况
	@RequestMapping("modaddSeslect_marital_status")
	@ResponseBody
	public Map modaddSeslect_marital_status(String text, int page, int rows) {

			long total = maritalstatusservice.count(text);
			List<MaritalStatus> list = maritalstatusservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 定义用工状态
	@GetMapping("to_Employment_status")
	public String to_Employment_status() {
		return "wdm_Employment_status";
	}

	// 定义用工状态分页查询
	@GetMapping("queryByto_Employment_status")
	@ResponseBody
	public Map queryByto_Employment_status(int page, int rows) {
		long total = jostatusservice.queryByPageCount();
		List<JobStatus> list = jostatusservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 定义用工状态查询
	@PostMapping("query_Employment_status")
	@ResponseBody
	public List<JobStatus> query_Employment_status() {
		List<JobStatus> list = jostatusservice.select();
		return list;
	}

	// 新增定义用工状态
	@RequestMapping("insert_Employment_status")
	@ResponseBody
	public Result2 insert_Employment_status(String jobsName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			jostatusservice.insert(jobsName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义用工状态
	@RequestMapping("delete_Employment_status")
	@ResponseBody
	public Result2 delete_Employment_status(Long jobsId) {
		try {
			jostatusservice.delete(jobsId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义用工状态
	@RequestMapping("load_Employment_status")
	@ResponseBody
	public JobStatus find_Employment_status(Long jobsId) {
		return jostatusservice.loadReasonsLeaving(jobsId);
	}

	// 编辑定义用工状态
	@RequestMapping("update_Employment_status")
	@ResponseBody
	public Result2 update_Employment_status(Long jobsId, String jobsName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			jostatusservice.update(jobsId, jobsName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义用工状态
	@RequestMapping("modaddSeslect_Employment_status")
	@ResponseBody
	public Map modaddSeslect_Employment_status(String text, int page, int rows) {
			long total = jostatusservice.count(text);
			List<JobStatus> list = jostatusservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 用工状态变动
	@GetMapping("to_ygzttable")
	public String to_ygzttable() {
		return "wdm_ygzttable";
	}

	// 用工状态变动新增页面
	@GetMapping("to_ygzttable_add")
	public String to_ygzttable_add() {
		return "add_ygzttable";
	}

	// 定义用工状态变动分页查询
	@GetMapping("queryByto_ygzttable")
	@ResponseBody
	public Map queryByto_ygzttable(int page, int rows) {
		long total = ygzttableservice.queryByPageCount();
		List<YgztTableVO> list = ygzttableservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增定义用工状态变动
	@RequestMapping("insert_ygzttable_add")
	@ResponseBody
	public Result2 insert_ygzttable(YgztTableVO ygztvo) {
		try {
			ygzttableservice.insert(ygztvo);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义用工状态变动
	@RequestMapping("delete_ygzttable")
	@ResponseBody
	public Result2 delete_ygzttable(Long ygztId) {
		try {
			ygzttableservice.delete(ygztId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 传值去编辑页面
	@RequestMapping("id_ygzttable")
	public String id_ygzttable(Long ygztId, Model m) {
		try {
			m.addAttribute("list", ygzttableservice.update(ygztId));
			return "compileygzttable_wdm";
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new ServiceException(e);
		}
	}

	// 编辑定义用工状态变动
	@PostMapping("update2_ygzttable")
	@ResponseBody
	public Result2 update2_ygzttable(YgztTableVO ygztvo) {
		try {
			ygzttableservice.updateAdministration(ygztvo);
			return Result2.SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 定义社会关系
	@GetMapping("to_social_relations")
	public String to_social_relations() {
		return "wdm_social_relations";
	}

	// 定义社会关系分页查询
	@GetMapping("queryByto_social_relations")
	@ResponseBody
	public Map queryByto_social_relations(int page, int rows) {
		long total = socialrelationsservice.queryByPageCount();
		List<SocialRelation> list = socialrelationsservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增定义社会关系
	@RequestMapping("insert_social_relations")
	@ResponseBody
	public Result2 insert_social_relations(String sociName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			socialrelationsservice.insert(sociName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义社会关系
	@RequestMapping("delete_social_relations")
	@ResponseBody
	public Result2 delete_social_relations(Long sociId) {
		try {
			socialrelationsservice.delete(sociId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义社会关系
	@RequestMapping("load_social_relations")
	@ResponseBody
	public SocialRelation find_social_relations(Long sociId) {
		return socialrelationsservice.loadReasonsLeaving(sociId);
	}

	// 编辑定义社会关系
	@RequestMapping("update_social_relations")
	@ResponseBody
	public Result2 update_social_relations(Long sociId, String sociName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			socialrelationsservice.update(sociId, sociName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义社会关系
	@RequestMapping("modaddSeslect_social_relations")
	@ResponseBody
	public Map modaddSeslect_social_relations(String text, int page, int rows) {

			long total = socialrelationsservice.count(text);
			List<SocialRelation> list = socialrelationsservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 定义民族
	@GetMapping("to_Ethnic")
	public String to_Ethnic() {
		return "ethnic";
	}

	// 定义民族分页查询
	@GetMapping("queryByto_Ethnic")
	@ResponseBody
	public Map queryByto_Ethnic(int page, int rows) {
		long total = nationalityservice.queryByPageCount();
		List<Nationality> list = nationalityservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增定义民族
	@RequestMapping("insert_Ethnic")
	@ResponseBody
	public Result2 insert_Ethnic(String natiName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			nationalityservice.insert(natiName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义民族
	@RequestMapping("delete_Ethnic")
	@ResponseBody
	public Result2 delete_Ethnic(Long natiId) {
		try {
			nationalityservice.delete(natiId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义民族
	@RequestMapping("load_Ethnic")
	@ResponseBody
	public Nationality find_Ethnic(Long natiId) {
		return nationalityservice.loadReasonsLeaving(natiId);
	}

	// 编辑定义民族
	@RequestMapping("update_Ethnic")
	@ResponseBody
	public Result2 update_Ethnic(Long natiId, String natiName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			nationalityservice.update(natiId, natiName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义民族
	@RequestMapping("modaddSeslect_Ethnic")
	@ResponseBody
	public Map modaddSeslect_Ethnic(String text, int page, int rows) {

			long total = nationalityservice.count(text);
			List<Nationality> list = nationalityservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 定义组织
	@GetMapping("to_organization")
	public String to_organization() {
		return "wdm_organization";
	}

	// 定义组织分页查询
	@GetMapping("queryByPage_organization")
	@ResponseBody
	public Map queryByPage_organization(int page, int rows) {
		long total = organizationservice.queryByCount();
		List<Organization> list = organizationservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	/**
	 * 定义组织新增
	 * 
	 * @return
	 */
	@RequestMapping("insert_organization")
	@ResponseBody
	public Result2 insert_Organization(String organiName, String organiRemarks, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			organizationservice.insert(organiName, organiRemarks, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义组织
	@RequestMapping("delete_organization")
	@ResponseBody
	public Result2 delete_organization(Long organiId) {
		try {
			organizationservice.delete(organiId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义组织
	@RequestMapping("load_organization")
	@ResponseBody
	public Organization find_organization(Long organiId) {
		return organizationservice.load(organiId);
	}

	// 编辑定义组织
	@RequestMapping("update_organization")
	@ResponseBody
	public Result2 update_organization(Long organiId, String organiName, String organiRemarks, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			organizationservice.update(organiId, organiName, saff.getStainName(), organiRemarks);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义组织
	@RequestMapping("modaddSeslect_organization")
	@ResponseBody
	public Map td_organization(String text, int page, int rows) {

			long total = organizationservice.count(text);
			List<Organization> list = organizationservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 定义职务
	@GetMapping("to_duty")
	public String to_duty() {
		return "wdm_duty";
	}

	// 定义职务分页查询
	@GetMapping("queryByPage_duty")
	@ResponseBody
	public Map queryByPage_duty(int page, int rows) {
		long total = dutyservice.queryByCount();
		List<Duty> list = dutyservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增定义职务
	@RequestMapping("insert_duty")
	@ResponseBody
	public Result2 insert_duty(String dutyName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			dutyservice.definedutyadd(dutyName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义职务
	@RequestMapping("delete_duty")
	@ResponseBody
	public Result2 delete_duty(Long dutyId) {
		try {
			dutyservice.definedutyremove(dutyId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义职务
	@RequestMapping("load_duty")
	@ResponseBody
	public Duty find_duty(Long dutyId) {
		return dutyservice.loadReasonsLeaving(dutyId);
	}

	// 编辑定义职务
	@RequestMapping("update_duty")
	@ResponseBody
	public Result2 update_duty(Long dutyId, String dutyName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			dutyservice.updatestate(dutyId, dutyName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义职务
	@RequestMapping("modaddSeslect_duty")
	@ResponseBody
	public Map td_duty(String text, int page, int rows) {

			long total = dutyservice.count(text);
			List<Duty> list = dutyservice.filedByName(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 员工职务变动
	@GetMapping("to_staffTurnover")
	public String to_staffTurnover() {
		return "staffturnover";
	}
	/**
	 * 模糊查询员工职务变动所有
	 * @param page
	 * @param rows
	 * @return
	 */
	@RequestMapping("find_likeall_staffturnover_mybatis")
	@ResponseBody
	public Map findLikeAllStaffturnover(String name,int page,int rows){
		Map map = new HashMap();
		Page<Object> p = PageHelper.startPage(page,rows);
		postitionchangeservice.findStaffTurnOverLikeAll(name);
		map.put("total", p.getTotal());
		map.put("rows",p.getResult());
		return map;
		
	}
	//删除
	/**
	 * 
	 * @param id
	 * @return
	 */
	@RequestMapping("delete_staffturnover")
	@ResponseBody
	public Result2 deleteStaffTurnOver(Long poBdId){
		try {
			postitionchangeservice.deleteStaffTurnOver(poBdId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

		// 编辑员工职务变动
		@GetMapping("compile_staffTurnover")
		public String compile_staffTurnover() {
			return "compilestaffturnover_wdm";
		}
	// 定义职务变动分页查询
	@RequestMapping("select_positionchange")
	@ResponseBody
	public Map select_positionchange(int page, int rows) {
		Page<JSONArray> p = PageHelper.startPage(page, rows);
		postitionchangeservice.findAll();
		Map map = new HashMap<>();
		map.put("total", p.getTotal());
		map.put("rows", p.getResult());
		return map;
	}
	//员工职务变动新增页面
	@GetMapping("to_staffTurnover_insert")
	public String to_staffTurnoverinsert(){
		return "staffturnover_insert_yj";
	}
	/**
	 * 奖惩信息新增查询所有员工分页
	 * @param page
	 * @param rows
	 * @return
	 */
	@RequestMapping("find-staffbouns-yj")
	@ResponseBody
	public Map findAllStaff(int page,int rows){
		long total = bonusadministrationservice.queryByPageCount();
		List<StafffinalVO> list = bonusadministrationservice.findAll(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}
	/**
	 * 奖惩信息新增点击员工赋值
	 * @param page
	 * @param rows
	 * @return
	 */
	@RequestMapping("find-one-staffbouns-yj")
	@ResponseBody
	public StafffinalVO LikefindOne(Long stainid){
		return bonusadministrationservice.LikefindOne(stainid);
	}
	/**
	 * 员工职务变动新增
	 * @param id
	 * @param id2
	 * @param time
	 * @param person
	 * @return
	 */
	@RequestMapping("insert_staffturnover_yj")
	@ResponseBody
	public Result2 insertStaffTurnOver(Long id,Long id2,Timestamp time,String person){
		try {
			postitionchangeservice.insertStaffTurnOver(id, id2, time, person);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}
	
	
	
	
	
	// 定义职称
	@GetMapping("to_professional")
	public String to_professional() {
		return "wdm_professional";
	}

	// 定义职称分页查询
	@GetMapping("queryByto_professional")
	@ResponseBody
	public Map queryByto_professional(int page, int rows) {
		long total = professionaltitleservice.pageByCount();
		List<ProfessionalTitle> list = professionaltitleservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增定义职称
	@RequestMapping("insert_professional")
	@ResponseBody
	public Result2 insert_Professional(String zcName, String zcSalary, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			professionaltitleservice.insert(zcName, saff.getStainName(), zcSalary);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义职称
	@RequestMapping("delete_professional")
	@ResponseBody
	public Result2 delete_professional(Long zcId) {
		try {
			professionaltitleservice.delete(zcId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义职称
	@RequestMapping("load_professional")
	@ResponseBody
	public ProfessionalTitle find_professional(Long zcId) {
		return professionaltitleservice.load(zcId);
	}

	// 编辑定义职称
	@RequestMapping("update_professional")
	@ResponseBody
	public Result2 update_Professional(Long zcId, String zcName, String zcSalary, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			professionaltitleservice.update(zcId, zcName, zcSalary, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义职称
	@RequestMapping("modaddSeslect_professional")
	@ResponseBody
	public Map td_forid(String text, int page, int rows) {

			long total = professionaltitleservice.count(text);
			List<ProfessionalTitle> list = professionaltitleservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 定义技能
	@GetMapping("to_wdm_skill")
	public String to_wdm_skill() {
		return "wdm_skill";
	}

	// 定义技能分页查询
	@GetMapping("queryByto_skill")
	@ResponseBody
	public Map queryByto_skill(int page, int rows) {
		long total = skillservice.queryByPageCount();
		List<Skill> list = skillservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}

	// 新增定义技能
	@RequestMapping("insert_skill")
	@ResponseBody
	public Result2 insert_skill(String skillName, String skillPerson, String skillRemark, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			skillservice.insert(skillName, saff.getStainName(), skillRemark);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 删除定义技能
	@RequestMapping("delete_skill")
	@ResponseBody
	public Result2 delete_skill(Long skillId) {
		try {
			skillservice.delete(skillId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载定义技能
	@RequestMapping("load_skill")
	@ResponseBody
	public Skill find_skill(Long skillId) {
		return skillservice.loadReasonsLeaving(skillId);
	}

	// 编辑定义技能
	@RequestMapping("update_skill")
	@ResponseBody
	public Result2 update_skill(Long skillId, String skillName, String skillRemark, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			skillservice.update(skillId, skillName, saff.getStainName(), skillRemark);
			return Result2.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}

	}

	// 模糊查询定义技能
	@RequestMapping("modaddSeslect_skill")
	@ResponseBody
	public Map td_skill(String text, int page, int rows) {
			long total = skillservice.count(text);
			List<Skill> list = skillservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 离职原因
	@GetMapping("to_reasons_for_leaving")
	public String reasons_for_leaving() {
		return "wdm_reasons_for_leaving";
	}

	// 离职原因分页查询
	@RequestMapping("queryByPage")
	@ResponseBody
	public Map queryByPage(int page, int rows) {
		long total = reasonsleaving.queryByPageCount();
		List<ReasonsLeaving> list = reasonsleaving.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;

	}

	// 模糊查询离职原因
	@RequestMapping("modaddSeslect_reasons")
	@ResponseBody
	public Map modaddSeslect_reasons(String text, int page, int rows) {
			long total = reasonsleaving.count(text);
			List<ReasonsLeaving> list = reasonsleaving.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	/**
	 * 新增离职原因
	 * 
	 * @param name
	 * @return
	 */
	@RequestMapping("insert_reasons")
	@ResponseBody
	public Result2 insert_reasons_for_leaving(String name, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			reasonsleaving.insert(name, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	/**
	 * 删除离职原因
	 * 
	 * @param reaslId
	 * @return
	 */
	@GetMapping("delete_reasons")
	@ResponseBody
	public Result2 delete_reasons(Long reaslId) {
		try {
			reasonsleaving.delete(reaslId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 编辑离职原因
	@RequestMapping("update_reasons")
	@ResponseBody
	public Result2 update_reasons(Long reaslId, String reaslName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			reasonsleaving.update(reaslId, reaslName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载离职原因
	@RequestMapping("load_reasons")
	@ResponseBody
	public ReasonsLeaving find_ReasonsLeaving(Long reaslId) {
		return reasonsleaving.loadReasonsLeaving(reaslId);
	}

	// 合同类别
	@GetMapping("to_contract_category")
	public String to_contract_category() {
		return "wdm_contract_category";
	}

	/**
	 * 新增合同类别
	 * 
	 * @param name
	 * @return
	 */
	@RequestMapping("insert_contract_category")
	@ResponseBody
	public Result2 insert_contract_category(String concaName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			contractcategoryservice.insert(concaName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	/**
	 * 删除合同类别
	 * 
	 * @param reaslId
	 * @return
	 */
	@GetMapping("delete_contract_category")
	@ResponseBody
	public Result2 delete_contract_category(Long concaId) {
		try {
			contractcategoryservice.delete(concaId);
			return Result2.SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 编辑合同类别
	@RequestMapping("update_contract_category")
	@ResponseBody
	public Result2 update_contract_category(Long concaId, String concaName, HttpSession session) {
		try {
			StaffInformation saff = (StaffInformation) session.getAttribute("staff");
			contractcategoryservice.update(concaId, concaName, saff.getStainName());
			return Result2.SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			return Result2.failure(e.getMessage());
		}
	}

	// 加载合同类别
	@RequestMapping("load_contract_category")
	@ResponseBody
	public ContractCategory find_contract_category(Long concaId) {
		return contractcategoryservice.loadReasonsLeaving(concaId);
	}

	// 合同类别分页查询
	@GetMapping("queryByPage_contract_category")
	@ResponseBody
	public Map queryByPagecontract_category(int page, int rows) {
		long total = contractcategoryservice.queryByPageCount();
		List<ContractCategory> list = contractcategoryservice.queryByPage(page, rows);
		Map map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;

	}

	// 模糊查询合同类别
	@RequestMapping("modaddSeslect_contract_category")
	@ResponseBody
	public Map modaddSeslect_contract_category(String text, int page, int rows) {
			long total = contractcategoryservice.count(text);
			List<ContractCategory> list = contractcategoryservice.selectForid_name(text, page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		

	}

	// 员工履历
	@GetMapping("to_employeesRecord")
	public String to_employeesRecord() {
		return "employeesrecord";
	}

	

	/*// 员工离职
	@GetMapping("to_LaborTurnover")
	public String to_LaborTurnover() {
		return "laborturnover";
	}

	// 员工离职
	@GetMapping("add_LaborTurnover")
	public String add_LaborTurnover() {
		return "addlaborturnover_wdm";
	}

	// 员工离职
	@GetMapping("compile_LaborTurnover")
	public String compile_LaborTurnover() {
		return "compilelaborturnover_wdm";
	}*/

	// 职位变动
	@GetMapping("to_JobTransfer")
	public String to_JobTransfer() {
		return "jobtransfer";
	}

	// 新增职位变动
	@GetMapping("add_JobTransfer")
	public String add_JobTransfer() {
		return "addjobtransfer_wdm";
	}

	// 编辑职位变动
	@GetMapping("compile_JobTransfer")
	public String compile_JobTransfer() {
		return "compilejobtransfer_wdm";
	}

	/*// 合同管理
	@GetMapping("to_ContractManagement")
	public String to_ContractManagement() {
		return "contractmanagement";
	}

	// 新增合同管理
	@GetMapping("add_ContractManagement")
	public String add_ContractManagement() {
		return "addcontractmanagement_wdm";
	}

	// 编辑合同管理
	@GetMapping("compile_ContractManagement")
	public String compile_ContractManagement() {
		return "compilecontractmanagement_wdm";
	}*/

	// 新增纪律处罚
	@GetMapping("add_DisciplinaryPunishment")
	public String add_DisciplinaryPunishment() {
		return "adddisciplinarypunishment_wdm";
	}

	// 奖励管理
	@GetMapping("to_IncentiveManagement")
	public String to_IncentiveManagement() {
		return "incentivemanagement";
	}

	// 新增员工奖励
	@GetMapping("add_to_IncentiveManagement")
	public String add_to_IncentiveManagement() {
		return "add_incentivemanagement_wdm";
	}

	// 编辑员工奖励
	@GetMapping("training_to_IncentiveManagement")
	public String training_to_IncentiveManagement() {
		return "training_incentivemanagement_wdm";
	}



}
